﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MetalSoda.Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            var server = new ServerInfo("localhost");
            var host = new ServiceHost("TestHost", databases: server["TestDatabase", autoCreate: true]);
                        
            var contract = new Contract("TestContract")
            .AddMessageType(new MessageType("TestRequest"), SentBy.Initiator)
            .AddMessageType(new MessageType("TestResponse"), SentBy.Target)
            .AddService(new Service("InitiatorService") { Queue = new Queue("InitiatorQueue") /* no activation */ })
            .AddService(new Service("TargetService") { Queue = new Queue("TargetQueue") { Activation = new Activation("TargetQueueProcessor", maxReaders: 1) } });

            host
                .AddService(contract.Service("InitiatorService"))
                .AddService(contract.Service("TargetService"));

            host
                .EndPoint("InitiatorService")
                .BindTo(host.EndPoint("TargetService"));

            ServiceHost.Deploy(host);            
        }
    }
}
